package com.symaster.backups.util;

import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;

/**
 * @author yinmiao
 * @version 2024/1/27
 */
public class ComponentUtil {

    public static <T> T getByClass(Component[] components, Class<T> clazz) {
        for (Component component : components) {
            if (clazz.isInstance(component)) {
                return clazz.cast(component);
            }
        }
        return null;
    }

    public static JPanel separatorPanel() {
        JPanel jPanel1 = new JPanel();
        jPanel1.setBorder(new LineBorder(new Color(194, 194, 194)));
        jPanel1.setPreferredSize(new Dimension(1, 1));
        return jPanel1;
    }
}
